import request from '@/utils/request'

export default {
    /**
     * 添加课程基本信息
     * @param {课程基本信息对象} course 
     * @returns 
     */
    addCourse(course) {
        return request({
            url: '/eduservice/course/addCourse',
            method: 'post',
            data: course
          })
    },
    /**
     * 查询所有讲师
     * @returns 
     */
    getTeacherList() {
        return request({
            url: '/eduservice/teacher/findAll',
            method: 'get'
          })
    },
    /**
     * 根据课程id查询课程基本信息
     * @param {课程id} courseId 
     */
    getCourseById(courseId) {
        return request({
            url: `/eduservice/course/getCourse/${courseId}`,
            method: 'get'
          })
    },
    /**
     * 修改课程基本信息
     * @param {课程基本信息对象} course 
     */
    updateCourse(course) {
        return request({
            url: '/eduservice/course/updateCourse',
            method: 'post',
            data: course
          })
    },
    /**
     * 根据课程id查询课程确认信息
     * @param {课程id} courseId 
     */
    getCoursePublish(courseId) {
        return request({
            url: `/eduservice/course/getCoursePublish/${courseId}`,
            method: 'get'
          })
    },
    /**
     * 发布课程
     * @param {课程id} courseId 
     */
    coursePublish(courseId) {
        return request({
            url: `/eduservice/course/coursePublish/${courseId}`,
            method: 'post'
          })
    },
    /**
     * 课程列表（条件查询分页）
     * @param {当前页} current 
     * @param {每页记录数} size 
     * @param {条件对象} courseQuery 
     * @returns 讲师分页对象
     */
    getPageCourseCondition(current, size, courseQuery) {
        return request({
            url: `/eduservice/course/pageCourseCondition/${current}/${size}`,
            method: 'post',
            data: courseQuery
          })
    },
    /**
     * 删除课程
     * @param {课程id} courseId 
     * @returns 
     */
    removeCourseByCourseId(courseId) {
        return request({
            url: `/eduservice/course/removeCourse/${courseId}`,
            method: 'delete'
          })
    }
}
